
var chartDom = document.getElementById('longtouzhongbiao');
var myChart = echarts.init(chartDom);
var option;

option = {
    graphic: [
        {
           type:"image",
           left:"5%",
           bottom:"84.5%",
           style: {
               image:"https://i.loli.net/2021/06/21/CvlGW8PErboK2YQ.png",
               width:"68",
               height:"45",
            }
         },
         ],
    title: {
        text: '2018-2021年垃圾焚烧中标项目中，龙头国企占比呈上升趋势',
        left:'12%',
        top: '10%',
        textStyle: {
            fontSize:20,
            color:"#FFFFFF",
            fontFamily: "Microsoft YaHei",
               },
    },
    backgroundColor:"rgba(0,21,46)",
    legend: {
        bottom: 20,
        itemGap: 20,
        textStyle: {
            color: '#fff',
            fontSize: 14
        },
        data: ['龙头国企', '非龙头国企'],
    },
    
    grid: {
        left: '5%',
        right: '10%',
        top:"25%",
        bottom: '15%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        axisLabel: {
                formatter: '{value} %',
                fontSize: 14,
                color:"rgba(149,152,175)",
            }
    },
    yAxis: {
        type: 'category',
        axisLabel: {
             fontSize: 14,
             color:"rgba(149,152,175)",
             },
        data: ['2021年', '2020年', '2019年', '2018年']
    },
    series: [
        {
            name: '龙头国企',
            type: 'bar',
            barWidth : 55,
            stack: 'total',
            color:new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
                    offset: 0,
                    color: 'rgba(166,107,86)'
                },
                {
                    offset: 1,
                    color: 'rgba(242,146,104)'
                }]),
            label: {
                show: true,
                position: 'inside',//数据在中间显示
                formatter:'{c}%',
                textStyle: { //数值样式
                        color: 'white',//字体颜色
                        fontSize: 14//字体大小
            },
            },
            emphasis: {
                focus: 'series'
            },
            data:[62.5,64,50,46]
        },
        
        {
            name: '非龙头国企',
            type: 'bar',
            stack: 'total',
            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                    offset: 0,
                    color: 'rgba(79,140,150)'
                }, {
                    offset: 1,
                    color: 'rgba(136,226,226)'
                }]),
            label: {
                show: true,
                position: 'inside',//数据在中间显示
                formatter:'{c}%',
                textStyle: { //数值样式
                        color: 'white',//字体颜色
                        fontSize: 14//字体大小
            },
            },
            emphasis: {
                focus: 'series'
            },
            data:[37.5,36,50,54]
        },],
         media: [
            {
                option: {
                    title:{                         
                    },
                }
            },
            {
                query: {
                    maxWidth: 500
                },
                option: {
                    title:{
                        left:"21%",
                        top:"0%",
                        text: '2018-2021年垃圾焚烧中标\n项目中，龙头国企占比呈上\n升趋势',
                    },
                    graphic: [
     {
           type:"image",
           left:"5%",
           bottom:"91.5%",
           style: {
               image:"https://i.loli.net/2021/06/21/CvlGW8PErboK2YQ.png",
               width:"68",
               height:"45",
            }
         },],
                }
            }
        ]
};

option && myChart.setOption(option);
